const infodata={
    data:[],
    childrenData:[]
}

const reducer=(state=infodata,{type,payload}:any)=>{
   let newState=JSON.parse(JSON.stringify(state))
   switch (type) {
    case "GET_LIST":
        newState.data=payload
        newState.childrenData=payload[0].children
      return newState
      case "CHILDREN_DATA":
        newState.childrenData=newState.data[payload].children
      return newState
   
    default:
        return newState
   }
}

export default reducer